// components/Login/Login.js
let table = wx.cloud.database()
var app = getApp()

Component({
    /**
     * 组件的属性列表
     */
    lifetimes: {
        ready: () => {
            this.setData({
                islogin:Boolean(app.globalData.userInfo)
            })
            console.log(Boolean(app.globalData.userInfo));
        }

    },
    options: {
        addGlobalClass: true
    },
    /**
     * 组件的初始数据
     */
    data: {
        islogin: true,

    },
    lifetimes: {
        ready: function () {
            this.setData({
                islogin: Boolean(app.globalData.userInfo)
            })
        }
    },
    /**
     * 组件的方法列表
     */
    methods: {
        ready() {
            wx.getUserProfile({
                desc: '用于登录账户密码', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
                success: (res) => {
                    table.collection('users').add({
                        data: res.userInfo,
                        success: (res) => {}
                    })
                    this.setData({
                        islogin: true
                    })
                }
            })
        },
        feel() {
            wx.navigateTo({
                url: '../../pages/userlist/feel/index',
                success: function (res) {}
            })
        },
        Burstrate(){
            wx.navigateTo({
                url: '../../pages/userlist/Burstrate/index',
                success: function (res) {}
            })
        }
    }
})